package com.labichaoka.chaoka.ui.record.borrow;

import com.labichaoka.chaoka.entity.OrderListResponse;

/**
 * Created by ruan on 2018/8/20.
 * 借款记录
 */

public class BorrowPresenterImpl implements BorrowPresenter,BorrowInteractor.onFinishedListener {
    private BorrowView view;
    private BorrowInteractor interactor;

    public BorrowPresenterImpl(BorrowView view, BorrowInteractor interactor) {
        this.view = view;
        this.interactor = interactor;
    }

    @Override
    public void getOrderList() {
        if (view!=null){
            view.showProgress();
        }
        interactor.getData(this);
    }

    @Override
    public void onDestroy() {
        view=null;
    }

    @Override
    public void onSuccessed(OrderListResponse response) {
        view.hideProgress();
        view.setData(response);
    }

    @Override
    public void onFailed() {
        view.hideProgress();
    }
}
